<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>个人中心</title>
		<link rel="stylesheet" type="text/css" href="__API__/lib/css/swiper.min.css">
		<link rel="stylesheet" type="text/css" href="__API__/lib/css/mui.css?v=1">
		<link rel="stylesheet" type="text/css" href="__API__/lib/css/mobileSelect.css" />
		<link rel="stylesheet" href="__API__/lib/css/style.css">
		<script type="text/javascript" src="__API__/lib/js/jquery-1.11.0.min.js"></script>
		<script type="text/javascript" src="__API__/lib/js/mui.js"></script>
		<script src="__API__/lib/js/mobileSelect.js" type="text/javascript" charset="utf-8"></script>
		<script src="__API__/lib/js/city.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" src="__API__/lib/js/swiper.min.js"></script>
		<script type="text/javascript" src="__API__/lib/js/vue.min.js"></script>
		<script type="text/javascript" src="__API__/lib/js/common.js"></script>
		<script type="text/javascript" src="__API__/lib/js/index.js"></script>
	<script src="https://cdn.staticfile.org/axios/0.18.0/axios.min.js"></script></head>

	<body>
	<style>
		.tool_list li span {
			display: block;
			font-size: .26rem;
			color: #666;
			margin-top: 0.2rem;
		}
		.section-con li p {
			font-size: .26rem;
			color: #666;
			margin-top: 0.15rem;
		}
		.alljump {
			display: block;
			font-size: .26rem;
			color: #999;
		}
		.myorder_ul li p {
			font-size: .26rem;
			color: #333;
			padding-top: 0.1rem;
		}
	</style>
		<div class="center_page bg_color" id="app">
			<div class="myhead">
				<div class="set" @click="goDetail('set.html')"><img src="__API__/lib/images/m_set.png" alt=""></div>
				<div class="myhead_info">
					<div class="left">
						<i><img :src="data.headimgurl != '' ? data.headimgurl : 'lib/images/head.png'"></i>
						<div class="myhead_box">
							<h3>{{data.nickname ? data.nickname : ''}}</h3>
							<span v-if="data.mobile">{{data.level_name}}</span>
							<p >{{data.mobile}}</p>
							<p >{{data.invite_code}}</p>
						</div>
					</div>
					<div class="ewm" @click="goDetail('poster.html?member_ids='+data.id)" ><img :src="ewmImg" alt=""></div>
				</div>
			</div>
			<div class="my_content">
				<div class="myorder">
					<div class="myorder_head border-bot">
						<h3>我的订单</h3>
						<a href="order.html" class="alljump">查看全部订单</a>
					</div>
					<ul class="myorder_ul">
						<li @click="goDetail('order.html?type=1')">
							<i><img src="__API__/lib/images/m_icon1.png"></i>
							<p>待付款</p>
						</li>
						<li @click="goDetail('order.html?type=2')">
							<i><img src="__API__/lib/images/m_icon2.png"></i>
							<p>待发货</p>
						</li>
						<li @click="goDetail('order.html?type=3')">
							<i><img src="__API__/lib/images/m_icon3.png"></i>
							<p>待收货</p>
						</li>
						<li @click="goDetail('order.html?type=4')">
							<i><img src="__API__/lib/images/m_icon4.png"></i>
							<p>售后</p>
						</li>
					</ul>
				</div>
				<div class="myorder">
					<div class="myorder_head">
						<h3>商家中心</h3>
					</div>
					<ul class="section-con">
						<li @click="goDetail('commission.html')">
							<span>{{data.brokerage}}</span>
							<p>收益</p>
						</li>
						<li @click="goDetail('commission2.html')">
							<span>{{data.integral}}</span>
							<p>购物积分</p>
						</li>
					</ul>
				</div>
				<div class="myorder">
					<div class="myorder_head">
						<h3>我的销售额</h3>
					</div>
					<ul class="section-con performance-con">
						<li>
							<span>{{purchase_num}}</span>
							<p>自购销售额</p>
						</li>
						<li>
							<span>{{directsales_num}}</span>
							<p>推荐销售额</p>
						</li>
						<li @click="goDetail('performance.html')">
							<span>{{totalsales_num}}</span>
							<p>总销销售额</p>
						</li>
						<li>
							<span>{{month_num}}</span>
							<p>当月销售额</p>
						</li>
					</ul>
				</div>
				<div class="myorder">
					<div class="myorder_head border-bot">
						<h3>常用工具</h3>
					</div>
					<ul class="tool_list">
						<li v-for="(item,i) in toolList" :key="i" @click="goDetail(item.path)"
							v-if="item.id != 9 && item.id != 10">
							<div class="icon"><img :src="item.iconImg" alt=""></div>
							<span>{{item.title}}</span>
						</li>
						<li v-for="(item,i) in toolList" :key="i"
							@click="item.id != 10 ? goDetail(item.path) : logOut()"
							v-if="(item.id == 9 || item.id == 10) && isLogin">
							<div class="icon"><img :src="item.iconImg" alt=""></div>
							<span>{{item.title}}</span>
						</li>
					</ul>
				</div>
			</div>
			<div class="fb"></div>
			<div class="footer">
				<div class="li" v-for="(item,i) in navList" :key="i">
					<span @click="goDetail(item.path)">
						<img :src="pageIndex == i ? item.selecticonPath : item.iconPath">
					</span>
					<p :class="{'blue':pageIndex == i}">{{item.title}}</p>
				</div>
			</div>
		</div>
		<script>
			var token = localStorage.getItem('token');
			if(!token){
				window.location = "{:url('login')}";
			}
			var app = null;
			app = new Vue({
				el: '#app',
				data: {
					isLogin: true, // 是否登录
					pageIndex: 3,
					navList: [{
						path: "{:url('index')}",
						iconPath: '__API__/lib/images/nav1.png',
						selecticonPath: '__API__/lib/images/nav1_on.png',
						title: '首页'
					},
						{
							path: "{:url('classification')}",
							iconPath: '__API__/lib/images/nav2.png',
							selecticonPath: '__API__/lib/images/nav2_on.png',
							title: '全部'
						},
						{
							path: "{:url('cart')}",
							iconPath: '__API__/lib/images/nav3.png',
							selecticonPath: '__API__/lib/images/nav3_on.png',
							title: '购物车'
						},
						{
							path: "{:url('my')}",
							iconPath: '__API__/lib/images/nav4.png',
							selecticonPath: '__API__/lib/images/nav4_on.png',
							title: '我的'
						}
					],
					headImg: '',
					username: '',
					company: '',
					phone: '',
					code: '',
					ewmImg: '__API__/lib/images/ewm.png',
					data:{},
					invite_code:'',
					commission: 0, //佣金
					integral: 0, //购物积分

					purchase_num: 0, //自购业绩
					directsales_num: 0, //直销业绩
					totalsales_num: 0, //总销业绩
					month_num: 0, //当月业绩

					toolList: [{
							id: 1,
							path: 'withdrawal_detail.html',
							iconImg: '__API__/lib/images/m_icon5.png',
							title: '提现明细'
						},
						{
							id: 2,
							path: 'withdrawal_bankcard.html',
							iconImg: '__API__/lib/images/m_icon6.png',
							title: '提现至银行卡'
						},
						{
							id: 3,
							path: 'withdrawal_wechat.html',
							iconImg: '__API__/lib/images/m_icon7.png',
							title: '提现至微信'
						},
						{
							id: 4,
							path: 'my_user.html',
							iconImg: '__API__/lib/images/m_icon8.png',
							title: '我的用户'
						},
						{
							id: 5,
							path: 'my_bank.html',
							iconImg: '__API__/lib/images/m_icon9.png',
							title: '我的银行'
						},
						{
							id: 6,
							path: 'my_address.html',
							iconImg: '__API__/lib/images/m_icon10.png',
							title: '我的地址'
						},
						{
							id: 7,
							path: 'update_loginpsd.html',
							iconImg: '__API__/lib/images/m_icon11.png',
							title: '修改登录密码'
						},
						// {
						// 	id: 8,
						// 	path: 'update_paypsd.html',
						// 	iconImg: 'lib/images/m_icon12.png',
						// 	title: '修改支付密码'
						// },
						// {
						// 	id: 9,
						// 	path: 'upload_documents.html',
						// 	iconImg: '__API__/lib/images/m_icon13.png',
						// 	title: '上传证件'
						// },
						// {
						// 	id: 10,
						// 	iconImg: '__API__/lib/images/m_icon14.png',
						// 	title: '重置身份'
						// }
					]
				},created: function() {

					var that = this;

					common.ajax("{:url('Member/my')}",{token:localStorage.getItem('token')} , function(res) {
						//common.showToast(res.msg);
						that.data = res.data;
						that.invite_code =res.data.invite_code


						// that.getData(searchValue);
					})
					common.ajax("{:url('Member/order')}",{token:localStorage.getItem('token')} , function(res) {
						//common.showToast(res.msg);
						that.purchase_num= res.self, //自购业绩
								that.directsales_num= res.son, //直销业绩
								that.totalsales_num=res.total, //总销业绩
								that.month_num= res.month //当月业绩

						// that.getData(searchValue);
					})
				},
				methods: {
					goDetail(url) {
						common.openUrl(url)
					},
					//恢复游客身份(退出登录)
					logOut() {
						let that=this;
						common.Confirm('注意:是否重置身份', '', function() {
							common.ajax("{:url('Member/init_level')}",{token:localStorage.getItem('token')} , function(res) {
								common.showToast(res.msg);
								common.ajax("{:url('Member/my')}",{token:localStorage.getItem('token')} , function(res) {
									//common.showToast(res.msg);
									that.data = res.data;

									// that.getData(searchValue);
								})

								// that.getData(searchValue);
							})
						})
					}
				},
			});
		</script>
	</body>

</html>
